package com.yueshop.yueshopsearch.controller;

import com.yueshop.yueshopsearch.service.ShopSearchService;
import com.yueshop.yueshopsearch.vo.SearchParam;
import com.yueshop.yueshopsearch.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {

    @Autowired
    ShopSearchService shopSearchService;

    @GetMapping("/list.html")
    public String listPage(SearchParam searchParam, Model model){

        SearchResult searchResult =   shopSearchService.search(searchParam);
        model.addAttribute("result",searchResult);
        return "list";
    }
}
